package edu.sctu.nieyu.trainsystem;

/**
 * Created by user01 on 2015/6/3.
 */
public class PassengerInformationProcess {

    Passenger passenger0 = new PassengerData().passengerData().get(0);
    Passenger passenger1 = new PassengerData().passengerData().get(1);
    Passenger passenger2 = new PassengerData().passengerData().get(2);
    Passenger passenger[] = {passenger0,passenger1,passenger2};

    public void setPassenger(){

        for (int i = 0; i <passenger.length ; i++) {
            System.out.println(passenger[i].getName());
            if (passenger[i].isIs_card()){
                if (passenger[i].getCardName().equals("超级贵宾卡")){
                    System.out.println("请进站！！");
                }else if (new Luggage(passenger[i]).checkLuggage()){
                    System.out.println("包裹存在安全问题，需进一步检查。");
                }else {
                    if (new Luggage(passenger[i]).checkWater()){
                        System.out.println("乘客所携带液体物品存在安全问题，需进一步检查！！");
                    }else {
                        if (passenger[i].getPrice()>2){
                            System.out.println("请进站！！");
                        }else {
                            System.out.println("请充值！！");
                            new Card().setPrice(10,passenger[i]);
                            System.out.println("充值成功，请进站！");
                        }
                        if (passenger[i].getPrice()>=new Card().getPrice(passenger[i].getStart(), passenger[i].getEnd())){
                            System.out.println("请出站，欢迎您再次乘坐本趟地铁！！");
                            System.out.println("您本次消费："+new Card().getPrice(passenger[i].getStart(), passenger[i].getEnd())
                                    +"\n您的天府通余额为："+(passenger[i].getPrice()-new Card().getPrice(passenger[i].getStart(), passenger[i].getEnd())));
                        }else {
                            System.out.println("请充值！");
                            new Card().setPrice(20,passenger[i]);
                            System.out.println("充值成功！请出站!");
                        }
                    }
                }
            }else {
                System.out.println("请购票！");
                if (new Luggage(passenger[i
                        ]).checkLuggage()){
                    System.out.println("包裹存在安全问题，需进一步检查。");
                }else {
                    if (new Luggage(passenger[i]).checkWater()){
                        System.out.println("乘客所携带液体物品存在安全问题，需进一步检查！！");
                    }else {
                        System.out.println("请出站并将您所购买的地铁单程票投入回收器中，欢迎您再次乘坐本趟地铁！");
                    }
                }
            }
        }
        }

    }

